/**
 * 用户管理相关API
 */
import request from '@/utils/request'

const api_base = '/sys-user'

export default {
  /**
   * 获取角色列表(带搜索)
   */
  getPageList: function(page, limit, searchObj) {
    return request({
      url: `${api_base}/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },
  removeById(id) {
    return request(({
      url: `${api_base}/${id}`,
      method: 'delete'
    }))
  },
  save(user) {
    return request({
      url: `${api_base}`,
      method: 'post',
      data: user
    })
  },
  // 编辑角色
  getById(id) {
    return request({
      url: `${api_base}/${id}`,
      method: 'get'
    })
  },
  update(data) {
    return request({
      url: `${api_base}`,
      method: 'put',
      data: data
    })
  },
  updateStatus(id, status) {
    return request({
      url: `${api_base}/${id}/${status}`,
      method: 'put'
    })
  },
  // 批量删除角色
  removeBatch(ids) {
    return request({
      url: `${api_base}/batch`,
      method: `delete`,
      data: ids
    })
  }
}
